home *** CD-ROM | disk | FTP | other *** search
- #ifndef FWPOSTEX_H
- #define FWPOSTEX_H
- //========================================================================================
- //
- // File: FWPostEx.h
- // Release Version: $ 1.0d11 $
- //
- // Copyright: (c) 1993, 1995 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWEXCEPT_H
- #include "FWExcept.h"
- #endif
-
- #ifndef FWSPOSTE_H
- #include "FWSPostE.h"
- #endif
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export on
- #endif
-
- //========================================================================================
- // CLASS FW_CPostedException
- //========================================================================================
-
- class FW_CLASS_ATTR FW_CPostedException
- {
-
- public:
-
- static void Initialize(FW_SPrivPostedExceptionGlobals& globals);
- // Initialize. Should only be called once, before any exception is posted.
- // Exception buffer is allocated as maxExceptionSize bytes.
-
- static void Terminate();
- // Cleanup. Releases exception buffer.
-
- static void PostException(const _FW_XException& exception);
- // Post an exception.
- // No-op if posted exception already pending.
-
- static short IsPendingException();
- // Returns 1 if an exception has been posted and not yet thrown.
- // Returns 0 otherwise.
-
- static void ThrowPostedException();
- // Throw the posted exception.
- // It is a no-op to invoke this function if no exception is pending.
-
- static FW_SPrivPostedExceptionGlobals& GetPostedExceptionGlobals();
-
- private:
-
- enum
- {
- kPostedExceptionGlobals = 116
- };
-
- private:
- static FW_SPrivPostedExceptionGlobals gGlobals;
- };
-
- //========================================================================================
- // FW_CPostedException inline functions
- //========================================================================================
-
- inline short FW_CPostedException::IsPendingException()
- {
- return GetPostedExceptionGlobals().gPending;
- }
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export off
- #endif
-
- #endif
-